package com.henu.zmb;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.henu.R;
import com.henu.zmb.entity.LoseGoods;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import cn.bmob.v3.datatype.BmobFile;

public class LoseGoodsDetails_Activity extends AppCompatActivity {
    ImageView stars;// 收藏按钮
    TextView title;
    TextView site;
    TextView time;
    TextView message;
    ImageView image;
    TextView phonenumber;
    ImageButton algd_return;
    boolean flag = true;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lose_goods_details);
        title = (TextView)findViewById(R.id.algd_tvtitle);
        site = (TextView)findViewById(R.id.algd_tvsite);
        time = (TextView)findViewById(R.id.algd_tvtime);
        message = (TextView)findViewById(R.id.algd_tvmessage);
        image = (ImageView)findViewById(R.id.algd_ivimage);
        phonenumber = (TextView)findViewById(R.id.algd_tphonenumber);
        algd_return = (ImageButton)findViewById(R.id.algd_return);
        Intent intent = getIntent();
        LoseGoods losegood = (LoseGoods)intent.getSerializableExtra("losegood");
        title.setText(losegood.getLoseGoods_Nmae());
        site.setText(losegood.getLoseGoods_Site());
        message.setText(losegood.getLoseGoods_Message());
        time.setText(losegood.getLoseGoods_Time());
        phonenumber.setText(losegood.getUserId().getMobilePhoneNumber());
        // 图片显示
        String url = (losegood.getLoseGoods_Image().getUrl()); // 获取地址
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .showImageOnLoading(R.mipmap.ic_launcher)
                .showImageOnFail(R.mipmap.ic_launcher)
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .bitmapConfig(Bitmap.Config.RGB_565)
                .build();

        ImageLoader.getInstance().displayImage(url, image, options);
        algd_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
